import { Modifier } from "../../base/Modifier";

export class ConstraintSizeModifier extends Modifier {
    static identity = Symbol("constraintSize");

    applyPeer(node: any, value: any) {
        //通用检查入参格式是否为对象。
        if (!this.CheckJSCallbackInfo(value, 111)) {
            //TODO, 判断时候后与后端如何交换！！！
            // ViewAbstractModel:: GetInstance() -> ResetMaxSize(true);
            // ViewAbstractModel:: GetInstance() -> ResetMinSize(true);
            // ViewAbstractModel:: GetInstance() -> ResetMaxSize(false);
            // ViewAbstractModel:: GetInstance() -> ResetMinSize(false);
            return;
        }

        //检查每个参数值格式
        let sizeObj = value;
        let minWidth = sizeObj["minWidth"];
        let maxWidth = sizeObj["maxWidth"];
        let minHeight = sizeObj["minHeight"];
        let maxHeight = sizeObj["maxHeight"];
        if (!this.CheckJsLengthValue(minWidth)) {
            //TODO:输入值不合法，直接返回，API V10 reset怎么办!
            //ViewAbstractModel::GetInstance()->SetMinWidth(minWidth);
            console.log('输入值不合法，直接返回，API');
            return false;
        }
        // console.log(direction);
        // globalThis.getArkUINativeModule().common.ParseLocationProps(node, direction) 
    }
} 